PreviousNextTracker indexSee it online !

(186/314) 3494710 - JCompiler error details aren't shown when using JDK7's javac

JCompiler does not show full error details as expected when it uses JDK7's javac and JCompiler's "Parse errors for the ^ column indicator" option is enabled,

This happens because the JDK7's javac uses a slightly different error message format: the column indicator line and its associated code line are printed at the beginning of the error message instead of the end as it was on JDK6(-).

By replacing jedit/plugins/JCompiler/trunk/jcompiler/JCompilerTask outputText method to the following, both JDK6(-) and JDK7 javac error formats are supported:
===
public void outputText(String line)
{
Log.log(Log.DEBUG, this, "#outputText: " + line);

Color color = null;

if (errorRE != null && errorRE.isMatch(line))
{

if(pendingError!=null)
{
if(prevLine!=null)
pendingError.addExtraMessage(prevLine);
pendingError.send();
}

boolean isWarning=warningRE != null && warningRE.isMatch(line);
int type = isWarning? ErrorSource.WARNING: ErrorSource.ERROR;
String filename = errorRE.substitute(line, rfilenamepos);
String lineno = errorRE.substitute(line, rlinenopos);
String message = errorRE.substitute(line, rmessagepos);
pendingError = new PendingError(type, filename,
Integer.parseInt(lineno) - 1, 0, 0, message, line);
prevLine=null;
color=isWarning?console.getWarningColor(): console.getErrorColor();
}
else if(pendingError!=null)
{
if(parseAccentChar && line.trim().equals("^"))
{
// a line with a single '^' in it: this determines the column
// position of the last compiler error.

// if the previous line contains a '^' too then ignore the current line.
if(prevLine==null || !prevLine.trim().equals("^"))
{
setStartEndPos(line);
prevLine = null;
}
}
else
{
if(prevLine!=null)
pendingError.addExtraMessage(prevLine);
prevLine=line;
}
}

output.print(color, line);
}
===
outputText.patch contains the equivalent svn diff patch if preferred.

Submitted nicarran - 2012-02-26 - 08:17:02z Assigned nobody
Priority 5 Category None
Status Open Group None
Resolution None Visibility No

Comments

Attachments

2012-02-26 - 08:17:03z
nicarran
outputText.patch

JCompilerTask - outputText method replacement